package com.kauto.gps.controller;

import com.kauto.gps.GpsFileManager;
import com.kauto.gps.bean.Gps;
import com.kauto.gps.bean.HttpResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/gps")
public class GpsController {
    @Autowired
    private GpsFileManager gpsFileManager;

    @RequestMapping(value = "/list", method = RequestMethod.POST)
    public HttpResult recvGps(@RequestBody List<Gps> list) {
        log.debug("recv gps size:{},list:{}", list.size(), list);
        gpsFileManager.addGpsList(list);
        return HttpResult.success();
    }
}
